import 'package:flutter_getx/utils/eventbus.dart';
import 'package:flutter_getx/utils/token.dart';
import 'package:get/get.dart';

import 'state.dart';

class TabLogic extends GetxController {
  final TabState state = TabState();

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();
    Future.delayed(Duration.zero, () async {
      await TokenManager().init();
    });
    eventBus.on<LogoutEvent>().listen((event) {
      // 跳转登录页面
      Get.offAllNamed('/login');
    });
  }

  @override
  void onReady() {
    // TODO: implement onReady
    super.onReady();
  }

  @override
  void onClose() {
    // TODO: implement onClose
    super.onClose();
    print('销毁么');
  }
}
